package org.jjche.bpm.modules.task.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.jjche.common.annotation.Dict;

import java.util.Arrays;

/**
 * 流程实例的结果
 *
 * @author jason
 */
@Getter
@AllArgsConstructor
public enum BpmProcessInstanceResultEnum implements Dict<Integer> {

    //处理中
    PROCESS(1, "处理中"),
    //通过
    APPROVE(2, "通过"),
    //不通过
    REJECT(3, "不通过"),
    //已取消
    CANCEL(4, "已取消"),

    // ========== 流程任务独有的状态 ==========
    BACK(5, "退回/驳回");

    BpmProcessInstanceResultEnum(Integer code, String text) {
        init(code, text);
    }

    public static boolean isEndResult(BpmProcessInstanceResultEnum result) {
        return Arrays.asList(APPROVE, REJECT, CANCEL, BACK).contains(result);
    }

}
